package com.quectel.core.module.car.entity.mongo;

import com.quectel.constant.BackupConfigConstants;
import com.quectel.core.constants.MongoCollectionConstants;
import com.quectel.util.client.mongo.MongoBaseModel;
import lombok.Data;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.MongoId;

import java.util.Date;

/**
 * 车辆访问记录表
 *
 * @author caolu
 * @email louis.cao@quectel.com
 * @date 2021-11-17 16:01:41
 */
@Data
@Document(MongoCollectionConstants.CAR_ACCESS_RECORD)
@CompoundIndex(name = "idx_device_id", def = "{'deviceId': 1}", background = true)
@CompoundIndex(name = "idx_tenant_village", def = "{'tenantId': 1,'villageId': 1}", background = true)
public class MongoCarAccessRecordModel implements MongoBaseModel {

    /**
     * id
     */
    @MongoId
    private Long id;

    /**
     * 租户id
     */
    private Long tenantId;

    /**
     * 小区id
     */
    private Long villageId;

    /**
     * 种类id
     */
    private Long deviceCategoryId;

    /**
     * 类型
     */
    private Long deviceTypeId;

    /**
     * 车辆id
     */
    private Long carId;

    /**
     * 设备id
     */
    private Long deviceId;

    /**
     * 设备名称
     */
    private String deviceName;

    /**
     * 车牌号
     */
    private String license;

    /**
     * 车牌颜色 1蓝底白字 2黄底黑字 3白底黑字 4绿底黑字 5黑底白字 6 02式车牌 7粤Z车牌 8FV车牌 9其他
     */
    private Byte licenseColor;

    /**
     * 车辆类型1住户车辆2租户车辆3访客车辆4服务车辆5其他
     */
    private Byte carType;

    /**
     * 进出方式 0未知 1进 2出
     */
    private Byte outOrIn;

    /**
     * 抓拍照片
     */
    private String snapImages;

    /**
     * 抓拍录像
     */
    private String snapVideoes;

    /**
     * 访问时间
     */
    @Indexed(name = "idx_access_time", background = true, expireAfterSeconds = BackupConfigConstants.MONGO_LOG_DATA_DEFAULT_RETAIN_SECONDS)
    private Date accessTime;

    /**
     * 纬度
     */
    private Double latitude;

    /**
     * 经度
     */
    private Double longitude;


}
